﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGiSelectProc : OdGiConveyorNode
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGiSelectProc(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdGiSelectProc_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGiSelectProc obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGiSelectProc()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGiSelectProc(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public override OdGiConveyorInput input()
		{
			OdGiConveyorInput result = new OdGiConveyorInput_Internal(GlobalsPINVOKE.OdGiConveyorNode_input(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public override OdGiConveyorOutput output()
		{
			OdGiConveyorOutput result = new OdGiConveyorOutput_Internal(GlobalsPINVOKE.OdGiConveyorNode_output(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdGiSelectProc cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiSelectProc_cast(OdRxObject.getCPtr(pObj));
			OdGiSelectProc result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiSelectProc)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiSelectProc)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiSelectProc)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiSelectProc_desc(), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiSelectProc_isA(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiSelectProc_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdGiSelectProc createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiSelectProc_createObject();
			OdGiSelectProc result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiSelectProc)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiSelectProc)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiSelectProc)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void set(OdGePoint2d pPoints, uint nPoints, OdGsView.SelectionMode mode, OdGsSelectionReactor pReactor)
		{
			GlobalsPINVOKE.OdGiSelectProc_set(this.swigCPtr, OdGePoint2d.getCPtr(pPoints), nPoints, (int)mode, OdGsSelectionReactor.getCPtr(pReactor));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void get(OdGePoint2dArray points, out OdGsView.SelectionMode mode)
		{
			GlobalsPINVOKE.OdGiSelectProc_get(this.swigCPtr, OdGePoint2dArray.getCPtr(points).Handle, out mode);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void check_n_fire_selected(uint flags)
		{
			GlobalsPINVOKE.OdGiSelectProc_check_n_fire_selected__SWIG_0(this.swigCPtr, flags);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void check_n_fire_selected()
		{
			GlobalsPINVOKE.OdGiSelectProc_check_n_fire_selected__SWIG_1(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setDeviation(OdGeDoubleArray deviations)
		{
			GlobalsPINVOKE.OdGiSelectProc_setDeviation__SWIG_0(this.swigCPtr, OdGeDoubleArray.getCPtr(deviations));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setDeviation(OdGiDeviation pDeviation)
		{
			GlobalsPINVOKE.OdGiSelectProc_setDeviation__SWIG_1(this.swigCPtr, pDeviation.GetCPtr());
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setDrawContext(OdGiConveyorContext pDrawCtx)
		{
			GlobalsPINVOKE.OdGiSelectProc_setDrawContext(this.swigCPtr, pDrawCtx.GetCPtr());
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public static bool supportsSubentitySelection(OdGiViewport pView, OdGsView.SelectionMode mode, OdGsSelectionReactor pReactor)
		{
			bool result = GlobalsPINVOKE.OdGiSelectProc_supportsSubentitySelection(OdGiViewport.getCPtr(pView), (int)mode, OdGsSelectionReactor.getCPtr(pReactor));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public const uint kCheckMarkerFinish = 2147483648u;

		public const int kCheckMarkerOnChange = 1;

		public const int kCheckMarkerOnViewModeChange = 2;

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
